<include file="Public/min-header" />
<script type="text/javascript">
    window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
    var URL_upload = "{$URL_upload}";
    var URL_fileUp = "{$URL_fileUp}";
    var URL_scrawlUp = "{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$URL_getRemoteImage}";
    var URL_imageManager = "{$URL_imageManager}";
    var URL_imageUp = "{$URL_imageUp}";
    var URL_getMovie = "{$URL_getMovie}";
    var URL_home = "{$URL_home}";
</script>
<load href="__ROOT__/Public/plugins/Ueditor/ueditor.config.js" />
<load href="__ROOT__/Public/plugins/Ueditor/ueditor.all.js" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 用户信息</h3>
                </div>
                <div class="panel-body">
                    <form action="" method="post" onsubmit="return checkUserUpdate(this);">
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <td class="col-sm-1 text-right">会员昵称:</td>
                                    <td>
                                        <input type="text" class="form-control" name="username" value="{$user.username}">
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td class = "text-right">头像:</td>
                                    <td>
                                        <img src="{$user.head_pic}" width="100" height="100"/>
                                        <input type="text" id="head_pic" readonly name="head_pic" value="{$user.head_pic}">
                                        <input type="button" class="button" onClick="GetUploadify(1, 'head_pic', 'head_pic', '')" value="上传头像照片" />
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td class = "text-right">性别:</td>
                                    <td id="order-status">
                            <input name="sex" type="radio" value="0" <if condition="$user['sex'] eq 0">checked</if> >保密
                            <input name="sex" type="radio" value="1" <if condition="$user['sex'] eq 1">checked</if> >男
                            <input name="sex" type="radio" value="2" <if condition="$user['sex'] eq 2">checked</if> >女
                            </td>
                            <td></td>
                            </tr>

                            <tr>
                                <td class = "text-right">手机:</td>
                                <td>
                                    <input type="text" class="form-control" name="mobile" value="{$user.mobile}">
                                </td>
                                <td></td>
                            </tr>

                                <tr>
                                    <td class = "text-right">通过手机验证:</td>
                                    <td>
                                        <input name="mobile_validated" type="radio" value="1" <if condition="$user['mobile_validated'] eq 1">checked</if> >是
                                        <input name="mobile_validated" type="radio" value="0" <if condition="$user['mobile_validated'] eq 0">checked</if> >否
                                    </td>
                                    <td></td>
                                </tr>


                                <tr>
                                    <td class = "text-right">所在地址：</td>
                                    <td>
                                        省
                                        <select name="province" id="province" onchange="provinceCG(this.value)">
                                            <volist name="provinceList" id="list">
                                                <option value="{$list.id}" <if condition="$list[id] eq $user[province]">selected="selected"</if>>{$list.name}</option>
                                            </volist>
                                        </select>
                                        市
                                        <select name="city" id="city" >
                                            <volist name="cityList" id="list">
                                                <option value="{$list.id}" <if condition="$list[id] eq $user[city]">selected="selected"</if>>{$list.name}</option>
                                            </volist>
                                        </select>

                                    </td>
                                </tr>



                                <tr>
                                <td class = "text-right">冻结用户:</td>
                                <td>
                            <input name="is_lock" type="radio" value="1" <if condition="$user['is_lock'] eq 1">checked</if> >是
                            <input name="is_lock" type="radio" value="0" <if condition="$user['is_lock'] eq 0">checked</if> >否
                            </td>
                            <td></td>
                            </tr>

                                <notempty name="user.user_id">
                            <tr>
                                <td class = "text-right">注册时间:</td>
                                <td>
                                    {$user.reg_time|date='Y-m-d H:i',###}
                                </td>
                                <td></td>
                            </tr>
                                </notempty>

                            </table>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    <button type="submit" class="btn btn-info">
                                        <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                    </button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function checkUserUpdate() {
//        var email = $('input[name="email"]').val();
        var mobile = $('input[name="mobile"]').val();


        var error = '';

//    if (!checkEmail(email)) {
//        error += "邮箱地址有误\n";
//    }
        if (!checkMobile(mobile)) {
            error += "手机号码填写有误\n";
        }
        if (error) {
            layer.alert(error, {
                icon: 2
            });
            return false;
        }
        return true;

    }


    function provinceCG(id){
        if(id === '')
            return;
        province_id = id;
        $('#city').html('');
        if(id){
            $.ajax({
                type: "GET",
                url: "/index.php?m=Admin&c=user&a=getCityByAjax&province_id=" + id, //+tab,
                success: function (data)
                {
                    if (data)
                    {
                        var data=eval('('+data+')');
                        city = data.list;
                        city_html = '';
                        for(i=0;i<city.length;i++){
                            city_html +=
                                '<option value="'+city[i].id+'" >'+city[i].name+'</option>';
                        }
                        $("#city").html(city_html);
                    }
                }
            });
        }
    }

</script>
</body>

</html>
